package com.wangzifan.controller;

import com.wangzifan.entity.Menu;
import com.wangzifan.entity.Result;
import com.wangzifan.service.MenuService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Slf4j
@RequestMapping("/menus")
public class MenuController {
    @Autowired
    private MenuService menuService;

    @GetMapping("/{username}")
    public Result getMenus(@PathVariable String username) {
        List<Menu> menus = menuService.getMenus(username);
        return Result.success(menus);
    }
}
